package com.jzhao.gper.demo.action;

import com.jzhao.gper.demo.service.IQueryService;
import com.jzhao.gper.spring.v3.annotation.JZAutowired;
import com.jzhao.gper.spring.v3.annotation.JZController;
import com.jzhao.gper.spring.v3.annotation.JZRequestMapping;
import com.jzhao.gper.spring.v3.annotation.JZRequestParam;
import com.jzhao.gper.spring.v3.webmvc.servlet.JZModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * 公布接口url
 * @author Tom
 *
 */
@JZController
@JZRequestMapping("/")
public class PageAction {

    @JZAutowired
    IQueryService queryService;

    @JZRequestMapping("/first.html")
    public JZModelAndView query(@JZRequestParam("teacher") String teacher){
        String result = null;
        try {
            result = queryService.query(teacher);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Map<String,Object> model = new HashMap<String,Object>();
        model.put("teacher", teacher);
        model.put("data", result);
        model.put("token", "123456");
        return new JZModelAndView("first.html",model);
    }

}
